package my392;

public class SuanFa392 {
    /**
     * 自己的蠢货版
     * @param s
     * @param t
     * @return
     */
    public boolean isSubsequence(String s, String t) {
        char[] chars1 = s.toCharArray();
        char[] chars2 = t.toCharArray();
        int len01 = chars1.length;
        int len02 = chars2.length;
        int node2 =0;
        int binggo = 0;
        for (int i = 0; i < len01; i++) {
            while(node2 < len02){
                if(chars1[i] == chars2[node2]){
                    node2++;
                    binggo++;
                    break;
                }
                node2++;
            }
        }
        if (binggo  == len01){
            return  true;
        }
        return false;
    }
    public static void main(String[] args) {
        SuanFa392 suanFa392 = new SuanFa392();
        boolean subsequence = suanFa392.isSubsequence("abc", "ahbgdc");
        System.out.println(subsequence);
    }


}
